odhcp6c: clear the socket buffer after initialising it master
authorLincoln Ramsay <[email protected]>
Mon, 8 Dec 2025 02:55:34 +0000 (10:55 +0800)
committerÁlvaro Fernández Rojas <[email protected]>
Tue, 9 Dec 2025 15:12:21 +0000 (16:12 +0100)
commit5212a1019d75db47a03c95c12e385e4625dda3d0
tree94c92f6c2e1699b7be0ebad40ec540ba24d2a7c5
parent1d6c4e794cdb86963e29b7dc332d0bc20ba6306c
odhcp6c: clear the socket buffer after initialising it

There is a chance that the socket receives packets it should not
process between its initial creation and when ra_init is finished.

Flush these from the buffer by calling recvmsg and throwing away
everything that is received.

This solves a race condition on a multi-interface device, where
several odhcp6c instances are started, and an RA for one interface
ends up in the queue for another interface's odhcp6c socket.

Signed-off-by: Lincoln Ramsay <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/133
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/ra.c